package com.twp.auth;

import com.twp.auth.annotation.EnableAuth;
import com.twp.common.component.process.statemachine.base.StateComponent;
import com.twp.common.component.process.statemachine.demo.DemoFuncMap;
import com.twp.common.component.process.statemachine.domain.StateNode;
import com.twp.common.component.process.statemachine.domain.iinterface.IMapRouterProcessStateNodeFunc;
import com.twp.common.tuple.ResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.javatuples.Pair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.util.HashMap;
import java.util.Map;

//@EnableAuth
//@SpringBootApplication
//@SpringCloudApplication
@Slf4j
@EnableTransactionManagement
@EnableScheduling
@EnableZuulProxy
public class AuthApplication {
    public static void main(String[] args){
        SpringApplication.run(AuthApplication.class,args);
    }

//    @Bean
//    public CommandLineRunner schedulerRunner() {
//        return new CommandLineRunner(){
//            @Override
//            public void run(String... args) throws Exception {
//                ResultDTO resultDTO =
//                        new StateComponent<StateNode,Map,Map<StateNode,IMapRouterProcessStateNodeFunc<StateNode>>,ResultDTO,Exception>
//                                (DemoFuncMap.builder().build()){
//                            @Override
//                            public StateNode onCreate() {
//                                return StateNode.builder().nodeCode("ttest01").build();
//                            }
//
//                            @Override
//                            public Pair<Map, StateNode> onStart() {
//                                return Pair.with(new HashMap(),StateNode.builder().nodeCode("ttest02").build());
//                            }
//
//                            @Override
//                            public void onException(Exception e) {
//
//                            }
//
//                            @Override
//                            public void onDestroy() {
//
//                            }
//                        }.runOnResp();
//                log.info(resultDTO.toString());
//            }
//        };
//    }
}
